package com.bosssoft.service_order.service.impl;

import com.bosssoft.service_order.domain.po.ShoppingTrolley;
import com.bosssoft.service_order.domain.po.ShoppingTrolleyExample;
import com.bosssoft.service_order.mapper.ShoppingTrolleyMapper;
import com.bosssoft.service_order.service.CartItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 购物车管理Service实现类
 */
@Service
public class CartItemServiceImpl implements CartItemService {
    @Autowired
    private ShoppingTrolleyMapper shoppingTrolleyMapper;


    @Override
    public List<ShoppingTrolley> list(Long uid, List<Long> cartIds) {
        ShoppingTrolleyExample example = new ShoppingTrolleyExample();
        example.createCriteria().andUserIdEqualTo(uid);
        return shoppingTrolleyMapper.selectByExample(example);
    }

    @Override
    public int delete(Long uid, Long pid) {
        return ShoppingTrolleyMapper.deleteByPrimaryKey(uid, pid);
    }


}
